package com.yzw.statistics.controller;

import com.yzw.common.dto.R;
import com.yzw.statistics.service.EduMemberService;
import com.yzw.statistics.service.EduStatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

//import org.apache.commons.lang3.RandomUtils;

/**
 * @Author Yzw
 * @Description TODO
 * @Date 2023/5/16 19:04
 * @Version 1.0
 */
@RequestMapping("/sta")
@RestController
public class StatisticsController {
    @Autowired
    EduStatisticsDailyService eduStatisticsDailyService;


    // 查询某一天注册的人数 生成统计数据
    @GetMapping("/registerCount/{day}")
    public R registerCount(@PathVariable String day) {
        Integer count = eduStatisticsDailyService.saveStatistics(day);
        return R.success("查询成功", count);
    }

    // 图表显示
    @GetMapping("/showData/{type}/{begin}/{end}")
    public R showData(@PathVariable String type,@PathVariable String begin,@PathVariable String end){
        Map<String,Object> map = eduStatisticsDailyService.showData(type,begin,end);
        return R.success("显示成功",map);
    }
}
